<h1>{{editType}}满减活动</h1>
<form name="userForm" novalidate>

    <div class="form-group">
        <label class="control-label">活动名称<span class="need">*</span></label>
        <input type="text" class="form-control" name="name" ng-model="activity.name" />
    </div>

    <div class="form-group">
        <label class="control-label db">添加产品:</label>

        <div class="radio">
            <label>
                <input type="radio" ng-model="activity.suit"  value="all">
                全场通用
            </label>
        </div>

        <div class="radio">
            <label>
                <input type="radio" ng-model="activity.suit" value="part">
                部分适用
            </label>
        </div>

        <div ng-show="activity.suit == 'part'">
        <a class="btn btn-primary btn-xs ml10" data-toggle="modal" data-target="#searchProductionModal"><span
                class="glyphicon glyphicon-plus"></span></a>
        <div class="mt5">
            <div ng-repeat="p in activity.production track by $index" class="lg dib">
                <span>产品名称:{{p.name}}</span>
                <a ng-click="remove(p, activity.production)">
                    <i class="remove ml2 cp glyphicon glyphicon-remove-sign glyphicon-white"></i></a>
            </div>
        </div>
    </div>



    

    <div class="form-group">
        <label class="control-label db">开始时间:</label>
        <div  datetimepicker id="dt" ng-model="activity.startTime"  class='input-group date'>
            <input type='text'   class="input-group-addon form-control lan" />
        </div>
    </div>



    <div class="form-group">
        <label class="control-label db">结束时间:</label>
        <div  datetimepicker id="de" ng-model="activity.endTime"  class='input-group date'>
            <input type='text'   class="input-group-addon form-control lan" />
        </div>
    </div>








    <div class="form-group" >
        <label class="control-label">优惠</label>
        <div class="form-group" >
            <label class="radio-inline">
                <input type="radio" ng-model="activity.level"  value="one"> 一级
            </label>
            <label class="radio-inline">
                <input type="radio" ng-model="activity.level" value="many"> 多级
            </label>
        </div>
        <div ng-show="activity.level =='one'">
            满 <input type="number" ng-model="activity.condition.value"> 元
            <div class="checkbox">
                <label>
                    <input type="checkbox" ng-model="activity.condition.cutPrice">
                     减现金
                </label>
            </div>
            <div class="checkbox">
                <label>
                    <input type="checkbox" ng-model="activity.condition.freeFreight">
                    免邮
                </label>
            </div>
            <div class="checkbox" >
                <label>
                    <input type="checkbox" ng-model="activity.condition.givePoints">
                   送积分
                </label>
            </div>
            <div class="checkbox">
                <label>
                    <input type="checkbox" ng-model="activity.condition.giveBenefit">
                   送优惠
                </label>
            </div>
            <div class="checkbox">
                <label>
                    <input type="checkbox" ng-model="activity.condition.givePresent">
                    送赠品
                </label>
            </div>
        </div>
        <div ng-show="activity.level =='many'">
            <div ng-repeat="condition in activity.conditions">
                满 <input type="number" ng-model="condition.value"> 元    <a ng-click="remove(condition, activity.conditions)">
                <i class="remove ml2 cp glyphicon glyphicon-remove-sign glyphicon-white"></i></a>
                <div class="checkbox">
                    <label>
                        <input type="checkbox" ng-model="condition.cutPrice">
                        减现金
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <input type="checkbox" ng-model="condition.freeFreight">
                        免邮
                    </label>
                </div>
                <div class="checkbox" >
                    <label>
                        <input type="checkbox" ng-model="condition.givePoints">
                        送积分
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <input type="checkbox" ng-model="condition.giveBenefit">
                        送优惠
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <input type="checkbox" ng-model="condition.givePresent">
                        送赠品
                    </label>
                </div>
            </div>

            <a  role="button" ng-click="addCondition()" class="mt10 btn btn-primary" >新增满减优惠</a>
        </div>



    </div>









    <div class="mt20 fix">
        <button class="btn btn-primary" ng-click="save()">保存</button>
        <button class="btn btn-link" ng-click="reset()">重置</button>
    </div>

</form>




<div class="modal fade" id="searchProductionModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button"
                        class="close"
                        data-dismiss="modal"
                        aria-hidden="true">x</button>
                <h3 id="userMgrLabel">搜索产品</h3>
            </div>
            <div class="modal-body">

                <form name="userForm" class="form-horizontal" role="form">
                    <div class="form-group" >
                        <label class="col-sm-2 control-label">搜索按</label>
                        <label class="radio-inline">
                            <input type="radio" name="inlineRadioOptions" id="inlineRadio1" ng-model="searchProType" selected value="name"> 产品名或编码
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="inlineRadioOptions" id="inlineRadio2" ng-model="searchProType" value="tag"> 标签
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="inlineRadioOptions" id="inlineRadio3" ng-model="searchProType" value="summary">简介
                        </label>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">关键词</label>
                        <div class="col-sm-10">
                            <ng-autocomplete class="ltw" ng-model="editRelation"
                                             show-property="name"
                                             delay="300"
                                             theme="blue"
                                             init-text=""
                                             get-result="searchProduction(keyword)"
                                             placeholder="搜索产品">
                            </ng-autocomplete>
                            <a class="btn btn-primary btn-xs ml10" ng-click="addProduction(editRelation)"><span
                                    class="glyphicon glyphicon-plus"></span></a>
                        </div>
                    </div>




                </form>

            </div>
            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
                <button class="btn btn-primary"
                        data-dismiss="modal"
                        aria-hidden="true"
                >确定</button>
            </div>
        </div>
    </div>
</div>
